
//https://www.nowcoder.com/practice/ccb7383c76fc48d2bbc27a2a6319631c?tpId=62&&tqId=29468&rp=1&ru=

#include <iostream>
using namespace std;

class Date
{
	friend istream& operator>>(istream& in, Date& d);
public:

	int GetMonthDay(int year, int month) const
	{
		static int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
		if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
		{
			return 29;
		}
		return monthDayArray[month];
	}

	Date& operator+=(int day);
	int operator-(const Date& d) const;

	bool operator<(const Date& d) const;
	bool operator<=(const Date& d) const;
	bool operator>(const Date& d) const;
	bool operator>=(const Date& d) const;
	bool operator==(const Date& d) const;
	bool operator!=(const Date& d) const;

private:
	int _year;
	int _month;
	int _day;
};

bool Date::operator<(const Date& d) const
{
	if (_year < d._year)
		return true;

	else if (_year == d._year)
	{
		if (_month < d._month)
			return true;
		else if (_month == d._month)
			return _day < d._day;
	}
	return false;
}

bool Date::operator<=(const Date& d) const
{
	return *this < d || *this == d;
}


bool Date::operator>(const Date& d) const
{
	return !(*this <= d);
}

bool Date::operator>=(const Date& d) const
{
	return !(*this < d);
}

bool Date::operator==(const Date& d) const
{
	return _year == d._year
		&& _month == d._month
		&& _day == d._day;
}

bool Date::operator!=(const Date& d) const
{
	return !(*this == d);
}

istream& operator>>(istream& in, Date& d)
{
	int tmp;
	in >> tmp;
	d._day = tmp % 100;
	tmp /= 100;
	d._month = tmp % 100;
	tmp /= 100;
	d._year = tmp;
	
	return in;
}

Date& Date::operator+=(int day)
{
	_day += day;
	while (_day > GetMonthDay(_year, _month))
	{
		_day -= GetMonthDay(_year, _month);
		++_month;
		if (_month == 13)
		{
			_year++;
			_month = 1;
		}
	}
	return *this;
}

int Date::operator-(const Date& d) const
{
	int n = 0;
	Date Max = *this;
	Date Min = d;
	if (*this < d)
	{
		Max = d;
		Min = *this;
	}

	while (Min <= Max)
	{
		Min += 1;
		++n;
	}

	return n;
}

int main()
{
	Date d1;
	Date d2;

	cin >> d1;
	cin >> d2;

	int result = d1 - d2;

	cout << result;

	return 0;
}